package com.huawei.hwid.usecase;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.huawei.hwid.UseCase;
import com.huawei.hwid.api.common.o;
import com.huawei.hwid.c.a.b;
import com.huawei.hwid.core.d.b.e;
import com.huawei.hwid.core.d.g;
import com.huawei.hwid.core.datatype.HwAccount;
import java.util.ArrayList;

public class WriteHwAccountUseCase extends UseCase<RequestValues> {
    private Context a;
    private ArrayList<HwAccount> b;
    private boolean c;

    public static final class RequestValues extends com.huawei.hwid.UseCase.RequestValues {
        public static final Creator<RequestValues> CREATOR = new Creator<RequestValues>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return a(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return a(i);
            }

            public RequestValues a(Parcel parcel) {
                return new RequestValues(parcel);
            }

            public RequestValues[] a(int i) {
                return new RequestValues[i];
            }
        };
        private String a;

        public RequestValues(String str) {
            this.a = str;
        }

        protected RequestValues(Parcel parcel) {
            this.a = parcel.readString();
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.a);
        }
    }

    public /* synthetic */ void b(com.huawei.hwid.UseCase.RequestValues requestValues) {
        a((RequestValues) requestValues);
    }

    public WriteHwAccountUseCase(Context context, ArrayList<HwAccount> arrayList, boolean z) {
        this.a = context;
        this.b = arrayList;
        this.c = z;
    }

    protected void a(RequestValues requestValues) {
        e.b("WriteHwAccountUseCase", "writeHwAccount", true);
        o.a(this.a, requestValues.a);
        g.a(this.a, "accounts.xml");
        try {
            b.a(this.a, "accounts.xml", this.b, this.c);
        } catch (Exception e) {
            e.c("WriteHwAccountUseCase", "Exception", true);
        }
    }
}
